<template>
    <div>
        <!-- 留言内容 -->
        <div>
            <!-- 留言通过props传递 -->
            <slot name="default"></slot>
        </div>

        <!-- 删除按钮，触发父组件的删除事件 -->
        <button @click="()=>emit('del')">删除留言</button>
    </div>
</template>

<script setup lang='ts'>
 import { defineEmits } from 'vue';

const emit = defineEmits(['del'])

defineExpose({

})
</script>

<style scoped>
/* 子组件 MessageItem 样式 */
div {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

button {
    background-color: #dc3545;
}

button:hover {
    background-color: #c82333;
}
</style>